/**
 * Description:
 * Class Name:PrintStackTraceTest
 * Date:2022/3/26 15:40
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第10章_异常处理._10_5_Java的异常跟踪栈;

class SelfException extends RuntimeException{
    SelfException(){}
    SelfException(String msg){super(msg);}
}

public class PrintStackTraceTest {
    public static void firstMethod(){
        secondMethod();
    }
    public static void secondMethod(){
        thirdMethod();
    }
    public static void thirdMethod(){
        throw new SelfException("自定义的异常信息 in thirdMethod");
    }

    public static void main(String[] args) {
        firstMethod();
    }
}
//Exception in thread "main" SelfException: 自定义的异常信息 in thirdMethod
//    at PrintStackTraceTest.thirdMethod(PrintStackTraceTest.java:24)
//    at PrintStackTraceTest.secondMethod(PrintStackTraceTest.java:21)
//    at PrintStackTraceTest.firstMethod(PrintStackTraceTest.java:18)
//    at PrintStackTraceTest.main(PrintStackTraceTest.java:28)